<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>  
<head>
<%@ include file="/SharedPages/SharedPage.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="language" value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}" scope="session" />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="properties.text" />
<title><fmt:message key="candidate" /></title>
<link rel="stylesheet" type="text/css" href="/jt-hr-WEB/css/styles.css">
<script type="text/javascript" src="candidateComment.js"></script>
</head>

<body>
<div id="header">
	    <div id="img">
        	<img class="center" src="/jt-hr-WEB/img/msg_header.jpg" height="100px" width="500px"/>    
    		<jsp:include page="/SharedPages/SharedPage.jsp"></jsp:include>
    	</div>
    </div>
<div class="content">

	<h3 align="center"><fmt:message key="candidatecom" /></h3>
	
<jsp:useBean id="listComments" class="java.util.Vector<Candidatecomment>" scope="session"/>
<jsp:useBean id="index" class="java.lang.Integer" scope="session"/>
<jsp:useBean id="operationIsSuccesfulComm" class="java.lang.String" scope="session"/>

<jsp:setProperty name="candidate" property="*"/> 
<jsp:setProperty name="listComments" property="*"/> 
<jsp:setProperty name="operationIsSuccesfulComm" property="*" />
<%@ page import="entityJPA.*" %>
<%@ page import="java.util.Vector" %>
 

<br>
<div class="alert-box success" id="succes" style="display:none;margin-left:5%"><span ><fmt:message key="succes" />:</span><fmt:message key="succesm" /></span></div>
<br>

<%
	if(operationIsSuccesfulComm=="yes"){
		%>
		<script>
			document.getElementById("succes").style.display='inline';
		</script>
		<% 
	}
 %>
<%@ include file="candidateCommentCRUD.jsp" %>

 
<table border="1" onclick="return activeClick();" class="infoTable" style="margin-left:25%;margin-top:2%;width:50%" >
<tr>
	<th><fmt:message key="comment" /></th>
	<th><fmt:message key="user" /></th>
</tr>
<%
  for ( int i = 0; i < listComments.size(); i++) {
        %>
        <tr onclick="populateFields(this);" style="cursor:pointer">
        	<td style="display:none;"><%= listComments.get(i).getIdCandidateComment() %></td> 
        	<td><%= listComments.get(i).getCandidateComment() %></td>
        	<td style="width:15%"><%= listComments.get(i).getUser().getUsername() %></td>
        	<td style="display:none"><%= listComments.get(i).getCandidate().getIdCandidate() %></td>
        </tr>
        <%
	}
%>

</table>

<script>
	var lang='<c:out value="${language}"/>';
	select=document.getElementById("language");
	if(lang=="de_DE"||lang=="de"){
		select.options[1].defaultSelected=true;
	}
	else if(lang=="ro_RO"||lang=="ro"){
		select.options[2].defaultSelected=true;
	}
	else {
		select.options[0].defaultSelected=true;
	}

	
</script>

</div>
</body>
</html>